/**
 * 配置后台请求地址（正式环境）
 * @return {[type]} [str]
 */
jQuery.httpRootPath = function () {
    return "http://test.haois.me/wxmp/";
    // return "http://mp.haois.me/";
}
jQuery.httpSharePath = function () {
    return "http://test.haois.me/wxmp/";
    // return "http://mp.haois.me/";
}
jQuery.wssPath = function(){
	return "http://111.231.253.134/wss";
}
var wssPath = "http://111.231.253.134/wss";
wssPath = "http://111.231.253.134:8086/WebSiteServer"

     /**
     * @api addRecord(data) 记录网站访问记录
     * @apiGroup Record
     * @apiName addRecord
     * @apiDescription 增加一个站访问记录
     * @apiParam {String} appId 网站Id/必填
     * @apiParam {String} fromPage/appKey 来源/关键字
     * @apiParamExample {json} 请求样例：
     * POST addRecord(data)
     * var data = 
     * {
		appId:"b5687a525261d6c7077c7d370f551b1b" ,
		appKey:"网站 关键字",
		fromPage:"location.href.split('#')[0]来源"
	 * }
     * @apiSuccessExample {json} 返回样例:
     * {code: "00", msg: "你是第33位访客"}
     */
function addRecord(data) {
	var replyStr ="";
	$.ajax({
		type: "POST",
		async: false,
		data: data,
		url: wssPath + "/record/add/" + data.appId,
		dataType: "json",
		success: function(reply) {
			replyStr = reply;
			console.log(reply)
			if(reply.code == "00") {
				//saveCookie
			}
		},
		error:function(){
			console.log("系统错误")
		}
	});
	return replyStr;
}

     /**
     * @api getRecordCount(data) 获取网站访问记录数
     * @apiGroup Record
     * @apiName addRecord
     * @apiDescription 增加一个站访问记录
     * @apiParam {String} appId 网站Id/必填
     * @apiParam {String} fromPage/appKey 来源/关键字
     * @apiParamExample {json} 请求样例：
     * POST addRecord(data)
     * var data = 
     * {
		appId:"b5687a525261d6c7077c7d370f551b1b" ,
	 * }
     * @apiSuccessExample {json} 返回样例:
     * {"code":"00","msg":"success","data":{"id":58,"count":33,"webName":"www.haois.me","appId":"b5687a525261d6c7077c7d370f551b1b","account":"test"}}
     */
function getRecordCount(data) {
	var replyStr ="";
	$.ajax({
		type: "GET",
		url: wssPath + "/website/see/" + data.appId,
		async: false,
		dataType: "json",
		success: function(reply) {
			replyStr = reply.data.count;
			console.log(reply)
			if(reply.code == "00") {
				
			}
		},
		error:function(){
			console.log("系统错误")
		}
	});
	return replyStr;
}
 	/**
     * @api {POST} addMsg(data) 增加留言信息
     * @apiGroup Message
     * @apiName add
     * @apiDescription 增加一条留言信息
     * @apiParam {String} appId 网站 appId
     * @apiParam {String} linkMan 联系人名字
     * @apiParam {String} phone 电话
     * @apiParam {String} linkAddr 地址
     * @apiParam {String} content 信息
     * @apiParam {String} fromPage 来源
     * @apiParam {String} linkTel 联系电话
     * @apiParam {String} title 标题
     * @apiParamExample {json} 请求样例：
     * POST addRecord(data)
     * var data = 
     * {
		appId:"b5687a525261d6c7077c7d370f551b1b" ,
		content:"测试"
	 * }
     * @apiSuccessExample {json} 返回样例:
     * 
     */
function addMsg(data){
	var replyStr ="";
	$.ajax({
		type: "POST",
		data: data,
		async: false,
		url: wssPath + "/msg/add/" + data.appId,
		dataType: "json",
		success: function(reply) {
			replyStr = reply;
			console.log(reply)
			if(reply.code == "00") {
				bol = true;
			}
		},
		error:function(){
			console.log("系统错误")
		}
	});
	return replyStr;
}
	
